/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       gpuprogrammaterial.cpp
 * Author:     karooolek
 * Created on: 2010-04-14
 *
 **********************************************************************************************************************/

#include "gpuprogrammaterial.h"

namespace mGameEngine
{
namespace Graphics
{

GPUProgramMaterial::GPUProgramMaterial() :
    Material(),
    _gpuProgram(NULL)
{
}

GPUProgramMaterial::GPUProgramMaterial(GPUProgram *gpuProgram) :
    Material(),
    _gpuProgram(gpuProgram)
{
}

GPUProgramMaterial::~GPUProgramMaterial()
{
}

void GPUProgramMaterial::set() const
{
    if(!_gpuProgram)
    {
        return;
    }

    if(!_gpuProgram->isCompiled())
    {
        _gpuProgram->compile();
    }

    _gpuProgram->use();
}

}
}